package com.summer.study.leetcode.tree;

import com.summer.study.leetcode.tree.enums.DfsSearchType;

import java.util.List;


/**
 * @auther: 杨杰
 * @date: 2019/7/30 14:13
 * @description:
 */
public class Test {

    /**
                5
            1       4
        7       3       6

    * */
    private static Node init() {
        Node<Integer> treeNode7 = new BinaryTreeNode(7, null, null);
        Node<Integer> treeNode1 = new BinaryTreeNode(1, treeNode7, null);
        Node<Integer> treeNode6 = new BinaryTreeNode(6, null, null);
        Node<Integer> treeNode3 = new BinaryTreeNode(3, null, null);
        Node<Integer> treeNode4 = new BinaryTreeNode(4, treeNode3, treeNode6);

        Node<Integer> root = new BinaryTreeNode(5, treeNode1, treeNode4);
        return root;
    }

    /**
                     A
                B         C
            D     E     F    G
    * */
    private static Node characterInit() {
        Node<Character> treeNodeD = new BinaryTreeNode('D', null, null);
        Node<Character> treeNodeE = new BinaryTreeNode('E', null, null);
        Node<Character> treeNodeF = new BinaryTreeNode('F', null, null);
        Node<Character> treeNodeG = new BinaryTreeNode('G', null, null);

        Node<Character> treeNodeB = new BinaryTreeNode('B', treeNodeD, treeNodeE);
        Node<Character> treeNodeC = new BinaryTreeNode('C', treeNodeF, treeNodeG);

        Node<Character> treeNodeA = new BinaryTreeNode('A', treeNodeB, treeNodeC);
        return treeNodeA;
    }

    public static boolean isValidBST(List<Node<Integer>> list) {
        if (list.size() > 2) {
            for (int i = 1; i < list.size() - 1; i++) {
                if (list.get(i - 1).getVal() > list.get(i).getVal()) {
                    return false;
                }
            }
        }
        return true;
    }

    public static void main(String[] args) {
        BinaryTree<Character> tree = new BinaryTree<>();
        tree.setRoot(init());
        BinaryTreeNode<Integer> root=(BinaryTreeNode)tree.getRoot();
        /*for (Node<Character> item:tree.bfs()){
            System.out.println(item.getVal());
        }*/


    }
}
